package com.wa.dto;

import com.wa.pojo.BaseEntity;
import com.wa.util.CommUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * 操作员信息
 * @Author Dawn
 * @Date 2021/10/21 16:22
 */
@Data
@EqualsAndHashCode(callSuper=true)
@AllArgsConstructor
@NoArgsConstructor
public class OperatorInfoDto extends BaseEntity {

    /**
     * 创建用户id
     */
    private Integer createUserId;

    /**
     * 创建用户邮箱
     */
    private String createUserEmail;

    /**
     * 创建用户名
     */
    private String createUserName;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 创建ip
     */
    private String createIp;

    public static OperatorInfoDto process(OperatorInfoDto system, OperatorInfoDto manual){
        if (system == null){
            system = new OperatorInfoDto();
        }
        if (manual != null){
            if (CommUtils.isNotEmpty(manual.getCreateIp())){
                system.setCreateIp(manual.getCreateIp());
            }
            if (CommUtils.isNotNull(manual.getCreateTime())){
                system.setCreateTime(manual.getCreateTime());
            }
            if (CommUtils.isNotNull(manual.getCreateUserId())){
                system.setCreateUserId(manual.getCreateUserId());
            }
            if (CommUtils.isNotEmpty(manual.getCreateUserEmail())){
                system.setCreateUserEmail(manual.getCreateUserEmail());
            }
            if (CommUtils.isNotEmpty(manual.getCreateUserName())){
                system.setCreateUserName(manual.getCreateUserName());
            }
        }
        return system;
    }
}
